﻿using System;
using System.Diagnostics.CodeAnalysis;
using iPhOwa.Exchange;
using iPhOwa.Exchange.ContentClasses;
using iPhOwa.Exchange.Managers;

namespace iPhOwa.Web
{
	/// <summary>
	/// View any item.
	/// </summary>
	public partial class ViewItem : iPhOwaPage
	{
		/// <summary>
		/// Page_Load Event
		/// </summary>
		[SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes")]
		protected void Page_Load(object sender, EventArgs e)
		{
			if(!IsPostBack)
			{
				Item item = ItemManager.Get(Path, OwaSession);

				switch(item.ContentClass)
				{
					case ContentClassNames.Appointment:

						Response.Redirect("~/ViewAppointment.aspx" + Request.Url.Query);

						break;

					case ContentClassNames.Message:

						Response.Redirect("~/ViewMessage.aspx" + Request.Url.Query);

						break;
				}
			}
		}
	}
}